$playlist-background-color: $body-tertiary-bg;
$description-lines: 3;
$long-description-lines: 8;

#playlists-page .playlist-view-options {
  display: flex;
  align-items: end;
  margin-top: 0.8rem;
  gap: 1rem;
}

.playlist-info .description {
  white-space: pre-wrap;
}

#playlists-container {
  display: flex;
  flex-wrap: wrap;
  padding-top: 1em;

  &.list-view {
    flex-direction: column;
  }

  .playlist {
    margin: 0.5em;
    width: 15em;
    height: 15em !important;
    position: relative;
    overflow: hidden;

    .playlist-card-action-dropdown {
      position: absolute;
      bottom: 0;
      width: 100%;
    }

    .playlist-card-action-button {
      position: absolute;
      bottom: 0;
      border: none;
      padding: 5px;
      width: 100%;
      display: block;
      color: white;
      background: $blue;

      &::after {
        display: none;
      }
    }

    .info {
      display: block;
      padding: 1em;
      height: 100%;
      width: 100%;
      background-color: $playlist-background-color;
      > * {
        margin: 0.5em 0;
        &:first-child {
          margin: 0;
        }
      }
    }
  }

  .playlist-card-list-view {
    display: flex;
    flex-direction: row;
    border: 1px solid $border-color;
    padding: 1rem;
    margin: 0.5rem 0;
    min-height: 8rem;
    border-radius: 10px;
    gap: 3rem;

    @media (max-width: 640px) {
      gap: 0;
    }

    &:hover {
      cursor: pointer;
    }

    .playlist-card-container {
      display: flex;
      justify-content: space-between;
      width: 100%;
      gap: 0.8rem;

      .playlist-info {
        display: flex;
        align-items: center;
        gap: 2rem;

        .playlist-index {
          min-width: 2rem;
          text-align: right;
          font-weight: bold;
        }
      }
    }

    .playlist-info-content {
      display: flex;
      flex-direction: column;
      margin-bottom: 1rem;

      @media (min-width: 640px) {
        margin-bottom: 0;
      }

      .playlist-title {
        font-size: 1.75rem;
        a {
          font-weight: 500;
          color: #353070;
          text-decoration: none;
        }
      }
    }

    .playlist-more-info {
      align-self: center;
      flex-shrink: 0;

      .playlist-stats {
        display: flex;
        flex-direction: column;

        .playlist-date {
          color: #6b7280;
          display: flex;
          align-items: center;
          gap: 8px;
        }
      }
    }

    .playlist-actions {
      align-self: center;
      margin: 1rem;
    }
  }
}

.new-playlist {
  margin: 0.5em;
  width: 15em;
  cursor: pointer;
  // using !important to overwrite styles from Card component
  // (not classes but DOM element.style
  background: $blue !important;
  height: initial !important;
  color: white;
  text-align: center;

  &.list-view {
    width: auto;
  }

  > div {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    font-size: 2em;
    padding: 1em;
    height: 100%;
    > span {
      // "Create new playlist" text
      line-height: 1.2em;
    }
  }
}

#playlist {
  .playlist-details {
    .title {
      line-height: 1em;
      padding-bottom: 0.5em;
      border-bottom: 1px solid $blue;
    }
    .info {
      display: flex;
      flex-wrap: wrap;
      color: $gray-600;
      margin: 0.5em 0;
      > * {
        padding: 0 0.7em;
      }
    }
  }

  #add-track {
    background-color: $orange !important;
    > *:first-child {
      display: flex;
      align-items: center;
      color: white;
      font-size: 1.3em;
      font-weight: bold;
    }
    > .search > * {
      width: 95%;
    }
  }
}
// The drag icon used for sorting items in a playlist
.playlist-item-card .main-content .drag-handle {
  align-items: center;
  cursor: move;
  flex: 0;
  display: block;
  align-self: center;
  min-width: 3em;
}

/* Pure CSS multiline ellipsis by Sagi Shrieber:
    http://hackingui.com/a-pure-css-solution-for-multiline-text-truncation/
*/
.text-summary {
  overflow: hidden;
  position: relative;
  line-height: 1.2em;
  max-height: $description-lines * 1.2em;
  line-clamp: $description-lines;
  -webkit-line-clamp: $description-lines;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  padding-right: 2em;
  margin-top: 0.5rem;
  mask-image: linear-gradient(180deg, #000 60%, transparent 98%);
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent 98%);

  &.long {
    max-height: $long-description-lines * 1.2em;
    line-clamp: $long-description-lines;
    -webkit-line-clamp: $long-description-lines;
  }

  &.expanded {
    line-clamp: none;
    -webkit-line-clamp: none;
    max-height: unset;
    mask-image: none;
    -webkit-mask-image: none;
  }

  p {
    margin-bottom: 0;
  }
}

.playlist-sort-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}
